<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1
        function fn(a){
            var sum=0;
            for(var i=1;i<=a;i++){
                sum+=i;
            }
            return sum;
        }
        console.log(fn(6));
        console.log("-----------");

        // 2
        function fn2(b){
            var sum2=1;
            for(var r=1;r<=b;r++){
                sum2*=r;
            }
            return sum2;
        }
        console.log(fn2(5));
        console.log("-----------");

        // 3
       function fn3(m,n){
           var max=m>n?m:n;
           for(var t=max;t<=m*n;t++){
                if(t%m==0&&t%n==0){
                    return t;
                }
           }
       } 
       console.log(fn3(3,7));

    </script>
</body>
</html>